<%! import cgi %>
<%inherit file="base.html"/>

<h2>${application['name']}</h2>
<div class="lastUpdated">
    ${_('Updated:')} ${application['meta']['pretty_last_updated']}
</div>
<div id="tabNav">
    <ul>
        <li class="selected"><a href="/application/">${_('Info')}</a></li>
        <li><a href="/application/create/">${_('Create')}</a></li>
        % if is_owner:
        <li><a href="/application/manage/">${_('Manage')}</a></li>
        % endif
    </ul>
    <div class="clr"><br/></div>
</div>
<div id="leftPanel">
    <img src="${application['picture']}" alt=""/>

    <div class="sideWidget">
        <h3>
            ${_('Info')}
        </h3>

        <table class="personal">
        <tr>
            <th>${_('version')}</th>
            <td>${application['system']['version']}</td>
        </tr>
        % if application['system']:
        <tr>
            <th>${_('can add to personal profile?')}</th>
            <td>${application['system']['principal_aware']}</td>
        </tr>
        <tr>
            <th>${_('can add to group?')}</th>
            <td>${application['system']['group_aware']}</td>
        </tr>
        % endif
        </table>
    </div>
</div>
<div id="mainPanel">
    <div class="section" id="info">
        <h3>
            About
            <span class="inlineNav">
                <a href="#author">${_('Author')}</a>
                <a href="#instances">${_('Example Content')}</a>
            </span>
        </h3>
        <p class="intro">
            % if application['profile']:
                <% nl2br(application['profile']['about']) %>
            % else:
                ${_('No description.')}
            % endif
        </p>
    </div>
    <div class="section" id="author">
        <h3>
            Author
            <span class="inlineNav">
                <a href="#wrapper">^ ${_('Top')}</a>
            </span>
        </h3>
        <p class="intro">
            % if not application['author_profile']:
                <span class="alert">${_('Unknown')}</span>
            % else:
                <a href="http://${application['author_profile']['iid']}.hexlabel.net/">${application['author_profile']['generic']['name']['values'][0]['value']}</a>
            % endif
        </p>
    </div>
    <div class="section" id="instances">
        <h3>
            Example Content
            <span class="inlineNav">
                <a href="#wrapper">^ ${_('Top')}</a>
            </span>
        </h3>
        % if len(application['content']) > 0:
            <p class="intro">${_('Below are examples of content created using this application.')}</p>
            <ul>
                % for c in application['content'][:5]:
                    <li>
                        <img src="${c['picture']}" class="thumbnail" alt=""/>
                        <a href="http://${c['iid']}.hexlabel.net">${c['title']}</a>
                        % if c['parent']['iid']:
                            <div class="parentInfo">Linked from <a href="http://${c['parent']['iid']}.hexlabel.net/">${c['parent']['name']}</a></div>
                        
                        % endif
                    </li>
                % endfor
            </ul>
        % else:
            <p class="intro">${_('No content.')} <a href="/application/create/">${_('Click here to create some content with this application.')}</a></p>
        % endif
    </div>
</div>

<!-- defs -->
<%def name="title()">P2P Fusion - Peerscape | ${application['name']}</%def>
<%def name="body_class()">application</%def>

<%def name="notifications()">
</%def>

<%def name="nl2br(s)">
    ${'<br/>'.join(cgi.escape(s).split("\n")) | n}
</%def>
